//package cn.xinfei.xdecision.rabbit.contain;
//
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.MessageListener;
//import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
//import org.springframework.amqp.rabbit.listener.MessageListenerContainer;
//import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import javax.annotation.Resource;
//import java.util.Collection;
//import java.util.List;
//
//@Slf4j
//@Component
//public class RabbitmqCustomerConfiguration {
//
//    @Resource
//    private RabbitListenerEndpointRegistry rabbitListenerEndpointRegistry;
//
//    @Autowired
//    private List<MessageListener> messageListeners;
//
//    @Autowired
//    private SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory;
//
//
//    @PostConstruct
//    // 添加Listener
//    public void addListener() {
//        Collection<MessageListenerContainer> listenerContainers = rabbitListenerEndpointRegistry.getListenerContainers();
//        MessageListenerContainer queue_a = rabbitListenerEndpointRegistry.getListenerContainer("1111");
////        if (!queue_a.isRunning()) {
////            queue_a.start();
////        }
////        MethodRabbitListenerEndpoint endpoint = new MethodRabbitListenerEndpoint();
////        endpoint.setMessageHandlerMethodFactory(messageHandlerMethodFactory);
////        endpoint.setBean(myQueueListener);
////        endpoint.setId(queueName);
////        endpoint.setMethod(method);
////        endpoint.setQueueNames(queueName);
////        endpoint.setErrorHandler(rabbitListenerErrorHandler);
////        rabbitListenerEndpointRegistry.registerListenerContainer(endpoint, rabbitListenerContainerFactory, true);
//    }
//}
//
